package com.five.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.five.pojo.Club;
import com.five.pojo.ClubJoin;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author lenovo
 */
@Mapper
public interface ClubDao extends BaseMapper<Club> {


    List<Club> list2(String cName , String cType);

    @Insert("insert into club(c_name , c_createtime , c_people , c_header , c_typenumber , c_type , status) values " +
            "(#{cName} , #{cCreateTime} , #{cPeople} , #{cHeader} , #{cTypeNumber} , #{cType} , #{status})")
    void addClub(Club club);

    @Update("update club set c_name=#{cName} , c_createtime=#{cCreateTime} , c_people=#{cPeople} , c_header=#{cHeader} , " +
            "c_type=#{cType} , status=#{status} , c_typenumber=#{cTypeNumber} where c_id=#{cId}")
    void updateClub(Club club);

    @Delete("delete from club where c_id=#{cId}")
    void deleteClub(Integer cId);

    @Select("select * from club where c_header=#{cheader}")
    List<Club> getByHeader(String cHeader);

    @Select("select count(*) total from club")
    Integer getTotal();

    @Update("update club set status=#{status} where c_id=#{cid}")
    void updateStatus(Integer status, Integer cid);
}
